package ar.com.e2solver.conf;

import java.io.IOException;
import java.util.Properties;

import ar.com.e2solver.exception.BusinessException;

/**
 * Configuracion del Solver
 * @author rodo
 *
 */
public class E2SolverConfiguration {
	
	private Integer populationNumber;
	private Integer iterations;
	
	public E2SolverConfiguration() throws BusinessException {
		// Levanta properties por default
		Properties properties = new Properties();
		try {
		    properties.load(this.getClass().getResourceAsStream("/e2Solver.properties"));
		    this.populationNumber = new Integer(properties.getProperty("configuration.default.population"));
		    this.iterations = new Integer(properties.getProperty("configuration.default.iterations"));
		
		} catch (NumberFormatException e) {
			throw new BusinessException("Properties mal formadas");
		} catch (IOException e) {
			throw new BusinessException("No se pueden levantar properties por default");
		}
	}
	
	public Integer getPopulationNumber() {
		return populationNumber;
	}
	public void setPopulationNumber(Integer populationNumber) {
		this.populationNumber = populationNumber;
	}
	public Integer getIterations() {
		return iterations;
	}
	public void setIterations(Integer iterations) {
		this.iterations = iterations;
	}

}
